package com.swq.java.code.chapter16.code07;

import java.util.*;

public class WildCastTest {
    public static void main(String[] args) throws Exception {
        List<Integer> listInteger = new ArrayList<Integer>();
        listInteger.add(11);

        //print (listInteger);  //编译出错
        printNew(listInteger); //合法
    }

    public static void print(Collection<Object> collection) {
        for (Object obj : collection)
            System.out.println(obj);
    }

    public static void printNew(Collection<?> collection) {
        for (Object obj : collection)
            System.out.println(obj);
    }
}	   
